package com.woniu.zsd.common.util;

import org.springframework.stereotype.Component;

@Component
public class RedisKey {
    //用户相关


    //rabbitmq消息id
    public static String rabbitmqMessageIdKey(String messageId) {
        return "rabbitmq:message:id:"+messageId;
    }
    //账号相关
    public static String signUpCodeSendOneMinLimitKey(String phone) {
        return "signup:flag:phone:"+phone;
    }

    public static String lockPhone(String phone) {
        return "lock:phone:"+phone;
    }

    public static String lockIdCardNumber(String idCardNumber) {
        return "lock:idcard:number:"+idCardNumber;
    }

    public static String accountPermission(Integer accountId) {
        return "account:permission:accountid:"+accountId;
    }

    public static String sendCodeCountKey(String phoneNumber) {
        return "send:code:count:phone:"+phoneNumber;
    }

    public static String signUpCodeKey(String phoneNumber) {
        return "signup:code:phone:"+phoneNumber;
    }

    public static String userAccessToken(String accessToken) {
        return "user:accessToken:"+accessToken;
    }

    public static String userRefreshToken(String accessToken) {
        return "user:refreshToken:accessToken:"+accessToken;
    }
    //accessToken存续时间
    public static String userAccessTokenExpireTime(String accessToken) {
        return "user:accessToken:expireTime:"+accessToken;
    }

    //短token
    public static String ACCESS_EXPIRE_TOKEN2(String accessToken) throws Exception {
        return "access:expire:token2:" + accessToken;
    }
    //长token
    public static String ACCESS_REFRESH_TOKEN2(String accessToken) throws Exception {
        return "access:refresh:token2:" + accessToken;
    }
    //资源权限列表
    public static String USER_PERMISSION_LIST2(Integer accountId)throws Exception {
        return "user:permission:list2:userId:"+accountId;
    }

    //用户菜单
    public static String USER_MENU_LIST2(Integer accountId)throws Exception {
        return "user:menu:list2:userId:"+accountId;
    }
    public static String USER_COLLECT(Integer userId)throws Exception {
        return "user:collect:" + userId;
    }

    public static String COLLECT_RANK()throws Exception {
        return "collect:rank:";
    }


    //类型树缓存
    public static String CACHE_TYPE_TREE()throws Exception{
        return "cache:type:tree";
    }

    public static String chatHistory(String recyclingOrderNum) {
        return "chat:history:recyclingOrderNum:"+recyclingOrderNum;
    }

    public static String chatWithCustomerServiceHistory(Integer userId) {
        return "chat:customer:service:userId:"+userId;
    }
}
